package jafer.tela;

import java.awt.Dimension;
import java.awt.Toolkit;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.JFrame;
import javax.swing.JMenu;
import javax.swing.JMenuBar;
import javax.swing.JMenuItem;
import javax.swing.JOptionPane;
import javax.swing.JSeparator;
import javax.swing.plaf.SeparatorUI;

public class Frame extends JFrame {
	
	public static final int DEFAULT_WIDTH = 500;	
	public static final int DEFAULT_HEIGHT = 400;

	public Frame(){
		
		JMenuBar barraMenu = new JMenuBar();
		JMenu menu = new JMenu("Menu");
		JMenuItem sobre = new JMenuItem("Sobre");
		sobre.addActionListener(new ActionListener() {
			
			@Override
			public void actionPerformed(ActionEvent e) {
				JOptionPane.showMessageDialog(null, "Jogo desenvolvido por Jafer Daltro");
								
			}
		});
		
		JMenuItem sair = new JMenuItem("sair");
		sair.addActionListener(new ActionListener() {
			
			@Override
			public void actionPerformed(ActionEvent e) {
				System.exit(0);
				
			}
		});
		
		menu.add(sobre);
		menu.add(new JSeparator());
		menu.add(sair);
		
		barraMenu.add(menu);
		
		setJMenuBar(barraMenu);
		
		add(new Fase());
		setTitle("Joguinho");
		setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		
		Toolkit kit = Toolkit.getDefaultToolkit();
		Dimension tamanhoTela=kit.getScreenSize();
		
		int width = tamanhoTela.width;
		int height = tamanhoTela.height;
		
		setLocation(width/2, height/2);
		setSize(DEFAULT_WIDTH,DEFAULT_HEIGHT);
		setVisible(true);
	}
	
	public static void main(String[] args) {
		new Frame();
	}
}
